<?php
namespace app\base\controller;
use app\base\model\BaseModel;
use think\Controller;
use app\base\service\Redis;
use think\Request;


/**
 * @title 测试
 * @description 测试
* @group 测试
 */
class index extends Controller
{
	/**
     * @title 测试
     * @description 测试
  
     * @author 凌杰
     * @url /base/index/index
     * @method POST
     * @return code:错误码
     * @return msg:错误消息
     * @return list:能量列表@
     * @list flag:标志位 num:分数
     */
	public function index(Request $re){
		$s =$re->param();
		dump($s);
		dump(session('userinfo'));
	}
	public function curl(){
		$data = 'theCityName=北京';$curlobj = curl_init();    
curl_setopt($curlobj, CURLOPT_URL, "http://www.qzone.com/index.php/base");  
curl_setopt($curlobj, CURLOPT_HEADER, 0); 
curl_setopt($curlobj, CURLOPT_RETURNTRANSFER, 1);  
curl_setopt($curlobj, CURLOPT_POST, 1);  
curl_setopt($curlobj, CURLOPT_COOKIE,'PHPSESSID=crio5qug8b23gprihvfgajhj83;');
curl_setopt($curlobj, CURLOPT_POSTFIELDS, $data);  
curl_setopt($curlobj, CURLOPT_HTTPHEADER, array("application/x-www-form-urlencoded; charset=utf-8", 
    "Content-length: ".strlen($data)
    )); 

$rtn = curl_exec($curlobj);   
if(!curl_errno($curlobj)){    // $info = curl_getinfo($curlobj); 
    // print_r($info);
    echo $rtn;  
} else {  echo 'Curl error: ' . curl_error($curlobj);
}
curl_close($curlobj);
	}


    public function test(){
        
        $redis=Redis::instance(["index"=>0]);
        $redis_1=Redis::instance(["index"=>1]);
        $redis_2=Redis::instance(["index"=>2]);
        $redis->set("name","This is mikkle's redis");
        $redis_1->set("name","This is mikkle's redis_1");
        $redis_2->set("name","This is mikkle's redis_2");
        dump( $redis->get("name"));
        dump( $redis_1->get("name"));
        dump( $redis_2->get("name"));
        dump($redis);
        dump($redis_1);
        dump($redis_2);
    
    }
}